//
//  KYCheckInNetDateModel.m
//  KYSignSDK
//
//  Created by 罗新 on 2017/10/25.
//  Copyright © 2017年 KuaiYan  Co.,LTD. All rights reserved.
//

#import "KYCheckInNetDateModel.h"
#import "KYCacheManager.h"

@implementation KYCheckInNetDateModel

+ (void)refreshCacheDataWithDict:(NSDictionary *)dict{
    KYCheckInNetDateModel *model = [[KYCheckInNetDateModel alloc] init];
    model.showWebUrl = dict[@"data"][@"url"];
    model.checkInImage = dict[@"data"][@"data"][@"imageurl"];
    model.checkInImageJumpUrl = dict[@"data"][@"data"][@"apkurl"];
    model.checkInStatisticsUrl = dict[@"data"][@"data"][@"url"];
    //存储签到信息
    KYCacheManager *cacheMgr = [KYCacheManager shareInstance];
    [cacheMgr ky_setObject:model forKey:KYCheckInNetDate];
}
+ (instancetype)getCacheData{
    KYCacheManager *cacheMgr = [KYCacheManager shareInstance];
    KYCheckInNetDateModel *model = (KYCheckInNetDateModel *)[cacheMgr ky_ObjectForKey:KYCheckInNetDate];
    return model;
}
+ (void)removeCacheData{
    KYCacheManager *cacheMgr = [KYCacheManager shareInstance];
    [cacheMgr ky_setObject:nil forKey:KYCheckInNetDate];
}
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.showWebUrl forKey:@"showWebUrl"];
    [aCoder encodeObject:self.checkInImage forKey:@"checkInImage"];
    [aCoder encodeObject:self.checkInImageJumpUrl forKey:@"checkInImageJumpUrl"];
    [aCoder encodeObject:self.checkInStatisticsUrl forKey:@"checkInStatisticsUrl"];
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self.showWebUrl = [aDecoder decodeObjectForKey:@"showWebUrl"];
    self.checkInImage = [aDecoder decodeObjectForKey:@"checkInImage"];
    self.checkInImageJumpUrl = [aDecoder decodeObjectForKey:@"checkInImageJumpUrl"];
    self.checkInStatisticsUrl = [aDecoder decodeObjectForKey:@"checkInStatisticsUrl"];
    return self;
}

@end
